package com.ycg.vue.utils;
import java.util.Random;
import java.util.UUID;

public class UUIDUtils {

    //<editor-fold desc="默认 ---> 32位UUID">
    public static String getUUID(){
        return UUID.randomUUID().toString().replaceAll("-", "");
    }
    //</editor-fold>

    //<editor-fold desc="根据入参，生成自定义长度的UUID">
    public static String getUUID(int len){
        return UUID.randomUUID().toString().replaceAll("-", "").substring(0,len);
    }
    //</editor-fold>


    //<editor-fold desc="自动生成n位随机数">
    public static String getRandomNumber(int n){
        StringBuilder str= new StringBuilder();
        for (int i = 0; i < n; i++) {
            str.append(new Random().nextInt(9) + 1);
        }
        return str.toString();
    }
    //</editor-fold>
}
